package com.stox.ui.javafx.charting.widget;

import java.util.Collection;

import javafx.scene.control.ContextMenu;

import org.springframework.stereotype.Component;

import com.stox.dto.AbstractModel;
import com.stox.dto.intf.AbstractModelNavigable;
import com.stox.ui.javafx.charting.view.ChartingView;

@Component
public class ChartingContextMenu extends ContextMenu implements
		AbstractModelNavigable<Collection<AbstractModel>> {
	private static final long serialVersionUID = 1L;
	
	private AbstractModelNavigable<? extends Collection<AbstractModel>> abstractModelNavigable;
	
	public void show(ChartingView chartingView, double x, double y) {
			if(null == chartingView) return;
			this.abstractModelNavigable = chartingView.getAbstractModelNavigable();
			super.show(chartingView, x, y);
	}
	
	@Override
	public AbstractModel next(boolean forward) {
		return null == abstractModelNavigable ? null : abstractModelNavigable.next(forward);
	}

	@Override
	public Collection<AbstractModel> get() {
		return null == abstractModelNavigable ? null : abstractModelNavigable.get();
	}

}
